<%@ page language="java" contentType="text/html; charset=UTF-8"
  pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html lang="zh-CN">

<head>

<%@ include file="/WEB-INF/include/meta.jsp"%>
<%@ include file="/WEB-INF/include/css.jsp"%>

</head>
<!-- end header -->
<body>
  <div class="page-group">
    <div class="page page-current">

      <header class="bar bar-nav fs-header-small fs-header-yellow">
        <c:choose>
          <c:when test="${not empty schedule}">
            <a href="${ctx.host}/course-schedules?day=${schedule.occurDate}&hour=${schedule.occurHour}" class="icon icon-left pull-left"></a>
          </c:when>
          <c:otherwise>
            <a href="${ctx.host}/students/${courseRound.student.id}?type=${courseRound.courseType}" class="icon icon-left pull-left"></a>
          </c:otherwise>
        </c:choose>
        <h1 class="title">课程详情</h1>
      </header>

      <div class="content">

        <div class="list-block media-list no-margin">
          <ul>
            <li class="course">
              <div class=" item-content">
                <div class="item-media">
                  <img src="${ctx.cdn}/${courseRound.course.cover}"
                    style='width: 4rem;'>
                </div>
                <div class="item-inner">
                  <div class="item-title-row">
                    <div class="item-title">${courseRound.course.name}（${courseRound.site.name}）</div>
                  </div>
                  <div class="item-subtitle">教练：${principal.name}</div>
                  <div class="item-text">
                    共&nbsp;<span class="color-danger">${courseSchedules.size()}</span>&nbsp;节课，已完成&nbsp;<span
                      class="color-danger">${courseRound.finished}</span>&nbsp;节课<br>
                  </div>
                </div>
              </div>
            </li>
          </ul>
        </div>

        <c:choose>
          <c:when test="${courseRound.courseType.alias eq 'group'}">
            <div class="schedule-warp" style="margin-top: 1rem;">
              <div class="content-padded no-margin">
                <div class="row course-schedule">

                  <c:forEach var="schedule" items="${courseSchedules}">
                    <c:choose>
                      <c:when test="${schedule.scheduleStatus.finish}">
                        <div class="col-33 finished">
                          <fmt:formatDate value="${schedule.occurDate}"
                            pattern="MM月dd日" />
                          <br> 已评价
                        </div>
                      </c:when>
                      <c:when test="${schedule.scheduleStatus.ready}">
                        <div class="col-33 waiting">
                          <fmt:formatDate value="${schedule.occurDate}"
                            pattern="MM月dd日" />
                          <br> ${schedule.occurHour}
                          <c:if
                            test="${schedule.coach.id eq coach.id and schedule.courseType.group}">
		                          &nbsp;(我)
		                        </c:if>
                        </div>
                      </c:when>
                      <c:when test="${schedule.scheduleStatus.expiry}">
                        <div class="col-33 expiry">
                          <fmt:formatDate value="${schedule.occurDate}"
                            pattern="MM月dd日" />
                          <br> ${schedule.occurHour} &nbsp;<small>(逾期)</small>
                        </div>
                      </c:when>
                      <c:when test="${schedule.scheduleStatus.schedule}">
                        <div class="col-33 undo">待排课</div>
                      </c:when>
                      <c:otherwise>
                        <div class="col-33 undo">待排课</div>
                      </c:otherwise>
                    </c:choose>

                  </c:forEach>

                </div>
              </div>
            </div>
          </c:when>

          <c:otherwise>
            <c:choose>
              <c:when test="${courseRound.fitnessGroup == null}">
                <div class="row">
                  <p class="text-center">暂未分组</p>
                </div>

                <div class="row course-grid" style="margin-left:0;">
                    <div class="col-25">
                      <a href="${ctx.host}/rounds/${courseRound.id}/schedules?type=EDITING">
                        <i class="icon icon-grid-schedule"></i><br>上课课时
                      </a>
                    </div>

                    <div class="col-25">
                      <a href="${ctx.host}/rounds/${courseRound.id}/inbody-records">
                        <i class="icon icon-grid-inbody"></i><br>体测记录
                      </a>
                    </div>

                    <div class="col-25">
                      <a href="${ctx.host}/rounds/${courseRound.id}/bwh-records">
                        <i class="icon icon-grid-bmr"></i> <br>三围记录
                      </a>
                    </div>
                    <div class="col-25">
                      <a href="${ctx.host}/rounds/${courseRound.id}/target">
                        <i class="icon icon-grid-target"></i> <br>学员目标
                      </a>
                  </div>
                </div>
              </c:when>

              <c:otherwise>
                <div class="row course-grid" style="margin-top: 1rem;">
                  <div class="col-33">
                    <a
                      href="${ctx.host}/rounds/${courseRound.id}/schedules">
                      <i class="icon icon-grid-schedule"></i> <br>
                      上课课时
                    </a>
                  </div>

                  <c:if test="${courseRound.courseType.year}">
                    <div class="col-33">
                      <a
                        href="${ctx.host}/rounds/${courseRound.id}/batch-coursewares?type=WEEKLY">
                        <i class="icon icon-grid-week"></i> <br> 家庭作业
                      </a>
                    </div>
  
                    <div class="col-33">
                      <a
                        href="${ctx.host}/rounds/${courseRound.id}/batch-coursewares?type=COURSE">
                        <i class="icon icon-grid-courseware"></i> <br> 上课课件
                      </a>
                    </div>
                  </c:if>

                  <!-- <div class="col-33">
                    <a
                      href="${ctx.host}/rounds/${courseRound.id}/inbody-records">
                      <i class="icon icon-grid-inbody"></i> <br>
                      体测记录
                    </a>
                  </div> -->

                  <c:set var="para" value="${empty schedule ? '?back=student' : '?scheduleId='}${schedule.id}"></c:set>
                  <div class="col-33">
                    <a href="${ctx.host}/rounds/${courseRound.id}/inbody-records${para}">
                      <i class="icon icon-grid-inbody"></i>
                      <br>身体数据                                                             
                    </a>
                  </div>
                  
                  <c:if test="${courseRound.courseType.individual}">
                    <div class="col-33">
                      <a href="${ctx.host}/rounds/${courseRound.id}/basic-information/target">
                        <i class="icon icon-grid-target"></i>
                        <br>目标                                                            
                      </a>
                    </div>
                    
                    <div class="col-33">
                      <a href="${ctx.host}/rounds/${courseRound.id}/basic-information/student-assessment${para}">
                        <i class="icon icon-grid-assessment"></i>
                        <br>学员评估                                                            
                      </a>
                    </div>
                    
                    <div class="col-33">
                      <a href="${ctx.host}/rounds/${courseRound.id}/weekly-plan${para}">
                        <i class="icon icon-grid-week"></i>
                        <br>周计划                                                            
                      </a>
                    </div>
                    
                    <div class="col-33">
                      <a href="${ctx.host}/rounds/${courseRound.id}/course-coursewares">
                        <i class="icon icon-grid-courseware"></i>
                        <br>课程                                                            
                      </a>
                    </div>
                    
                    <div class="col-33">
                      <a href="${ctx.host}/rounds/${courseRound.id}/result-report${para}">
                        <i class="icon icon-grid-report"></i>
                        <br>成果报告                                                            
                      </a>
                    </div>
                  </c:if>
                </div>
              </c:otherwise>

            </c:choose>
          </c:otherwise>
        </c:choose>
      </div>

    </div>
  </div>

  <%@ include file="/WEB-INF/include/script.jsp"%>

</body>
</html>